/*            Copyright(c) 2006-2008 Dave Sexton           *
 * http://www.codeplex.com/DocProject                      *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using DaveSexton.DocProject.Resources;

namespace DaveSexton.DocProject.Wizards
{
	public partial class WizardStepHeader : UserControl
	{
		#region Public Properties
		[Category("Appearance"), Description("Specifies the header image.")]
		public Image Image
		{
			get
			{
				return headerImage.Image;
			}
			set
			{
				headerImage.Image = value;
			}
		}

		[Category("Appearance"), DefaultValue(""), Description("Specifies the header text.")]
		public string LabelText
		{
			get
			{
				return headerLabel.Text;
			}
			set
			{
				headerLabel.Text = value;
			}
		}
		#endregion

		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="WizardStepHeader" /> class.
		/// </summary>
		public WizardStepHeader()
		{
			InitializeComponent();
		}
		#endregion

		#region Methods
		private bool ShouldSerializeImage()
		{
			return Image != Images.WizardStepGeneral;
		}

		private void ResetImage()
		{
			Image = Images.WizardStepGeneral;
		}
		#endregion

		#region Event Handlers
		private void headerPanel_Paint(object sender, PaintEventArgs e)
		{
			int height = (int) (headerPanel.Height / 2.75);
			int y = headerPanel.Height - height;
			Rectangle location = new Rectangle(0, y, headerPanel.Width, height);
			Rectangle brushArea = new Rectangle(0, y, headerPanel.Width, height);

			using (LinearGradientBrush brush = new LinearGradientBrush(
				brushArea, Color.White, Color.LightSteelBlue, LinearGradientMode.Vertical))
			{
				e.Graphics.FillRectangle(brush, location);
			}
		}
		#endregion
	}
}
